using System;
using System.ComponentModel;
using System.Diagnostics;
using System.Drawing;
using System.IO;
using System.Windows.Forms;
using DukeyCssFetch.api;

namespace DukeyCssFetch.UI
{
	// Token: 0x02000039 RID: 57
	public class ucFileExploer : UserControl
	{
		// Token: 0x06000248 RID: 584 RVA: 0x0001CE9C File Offset: 0x0001B09C
		public ucFileExploer()
		{
			
			this.InitializeComponent();
			MiddleModule.eventSend += new Send(this.method_0);
		}

		// Token: 0x06000257 RID: 599 RVA: 0x0001D55C File Offset: 0x0001B75C
		protected override void Dispose(bool disposing)
		{
			if (disposing && this.icontainer_0 != null)
			{
				this.icontainer_0.Dispose();
			}
			base.Dispose(disposing);
		}

		// Token: 0x06000258 RID: 600 RVA: 0x0001D57C File Offset: 0x0001B77C
		private void InitializeComponent()
		{
			this.icontainer_0 = new Container();
			ComponentResourceManager componentResourceManager = new ComponentResourceManager(typeof(ucFileExploer));
			this.treeFileList = new TreeView();
			this.cmenu_fileop = new ContextMenuStrip(this.icontainer_0);
			this.打开文件ToolStripMenuItem = new ToolStripMenuItem();
			this.打开文件位置ToolStripMenuItem = new ToolStripMenuItem();
			this.剪切CutToolStripMenuItem = new ToolStripMenuItem();
			this.复制CopyToolStripMenuItem = new ToolStripMenuItem();
			this.重命名RenameToolStripMenuItem = new ToolStripMenuItem();
			this.删除文件ToolStripMenuItem = new ToolStripMenuItem();
			this.imageList_0 = new ImageList(this.icontainer_0);
			this.cmenu_fileop.SuspendLayout();
			base.SuspendLayout();
			this.treeFileList.AllowDrop = true;
			this.treeFileList.ContextMenuStrip = this.cmenu_fileop;
			this.treeFileList.Dock = DockStyle.Fill;
			this.treeFileList.ImageIndex = 0;
			this.treeFileList.ImageList = this.imageList_0;
			this.treeFileList.ItemHeight = 21;
			this.treeFileList.Location = new Point(0, 0);
			this.treeFileList.Name = "treeFileList";
			this.treeFileList.SelectedImageIndex = 0;
			this.treeFileList.Size = new Size(273, 392);
			this.treeFileList.TabIndex = 0;
			this.treeFileList.BeforeCollapse += new TreeViewCancelEventHandler(this.treeFileList_BeforeCollapse);
			this.treeFileList.BeforeExpand += new TreeViewCancelEventHandler(this.treeFileList_BeforeExpand);
			this.treeFileList.NodeMouseDoubleClick += new TreeNodeMouseClickEventHandler(this.treeFileList_NodeMouseDoubleClick);
			this.treeFileList.DragDrop += new DragEventHandler(this.treeFileList_DragDrop);
			this.treeFileList.DragEnter += new DragEventHandler(this.treeFileList_DragEnter);
			this.cmenu_fileop.Font = new Font("Segoe UI", 9f);
			this.cmenu_fileop.Items.AddRange(new ToolStripItem[]
			{
				this.打开文件ToolStripMenuItem,
				this.打开文件位置ToolStripMenuItem,
				this.剪切CutToolStripMenuItem,
				this.复制CopyToolStripMenuItem,
				this.重命名RenameToolStripMenuItem,
				this.删除文件ToolStripMenuItem
			});
			this.cmenu_fileop.Name = "cmenu_fileop";
			this.cmenu_fileop.Size = new Size(147, 136);
			this.打开文件ToolStripMenuItem.Name = "打开文件ToolStripMenuItem";
			this.打开文件ToolStripMenuItem.Size = new Size(146, 22);
			this.打开文件ToolStripMenuItem.Text = "打开";
			this.打开文件ToolStripMenuItem.Click += new EventHandler(this.打开文件ToolStripMenuItem_Click);
			this.打开文件位置ToolStripMenuItem.Name = "打开文件位置ToolStripMenuItem";
			this.打开文件位置ToolStripMenuItem.Size = new Size(146, 22);
			this.打开文件位置ToolStripMenuItem.Text = "打开文件位置";
			this.打开文件位置ToolStripMenuItem.Click += new EventHandler(this.打开文件位置ToolStripMenuItem_Click);
			this.剪切CutToolStripMenuItem.Name = "剪切CutToolStripMenuItem";
			this.剪切CutToolStripMenuItem.Size = new Size(146, 22);
			this.剪切CutToolStripMenuItem.Text = "剪切(&T)";
			this.剪切CutToolStripMenuItem.Click += new EventHandler(this.剪切CutToolStripMenuItem_Click);
			this.复制CopyToolStripMenuItem.Name = "复制CopyToolStripMenuItem";
			this.复制CopyToolStripMenuItem.Size = new Size(146, 22);
			this.复制CopyToolStripMenuItem.Text = "复制(&Y)";
			this.复制CopyToolStripMenuItem.Click += new EventHandler(this.复制CopyToolStripMenuItem_Click);
			this.重命名RenameToolStripMenuItem.Name = "重命名RenameToolStripMenuItem";
			this.重命名RenameToolStripMenuItem.Size = new Size(146, 22);
			this.重命名RenameToolStripMenuItem.Text = "重命名(&M)";
			this.重命名RenameToolStripMenuItem.Click += new EventHandler(this.重命名RenameToolStripMenuItem_Click);
			this.删除文件ToolStripMenuItem.Name = "删除文件ToolStripMenuItem";
			this.删除文件ToolStripMenuItem.Size = new Size(146, 22);
			this.删除文件ToolStripMenuItem.Text = "删除文件(&D)";
			this.删除文件ToolStripMenuItem.Click += new EventHandler(this.删除文件ToolStripMenuItem_Click);
			this.imageList_0.ImageStream = (ImageListStreamer)componentResourceManager.GetObject("imageList.ImageStream");
			this.imageList_0.TransparentColor = Color.Transparent;
			this.imageList_0.Images.SetKeyName(0, "FolderClosed.ico");
			this.imageList_0.Images.SetKeyName(1, "folderopen.ico");
			this.imageList_0.Images.SetKeyName(2, "html.gif");
			this.imageList_0.Images.SetKeyName(3, "jpg.gif");
			this.imageList_0.Images.SetKeyName(4, "css.gif");
			this.imageList_0.Images.SetKeyName(5, "js.gif");
			this.imageList_0.Images.SetKeyName(6, "xml.gif");
			base.AutoScaleDimensions = new SizeF(6f, 12f);
			base.AutoScaleMode = AutoScaleMode.Font;
			base.Controls.Add(this.treeFileList);
			base.Name = "ucFileExploer";
			base.Size = new Size(273, 392);
			this.cmenu_fileop.ResumeLayout(false);
			base.ResumeLayout(false);
		}

		// Token: 0x06000249 RID: 585 RVA: 0x0001CEC0 File Offset: 0x0001B0C0
		private void method_0(object object_0, object object_1)
		{
			FormInfo formInfo = object_1 as FormInfo;
			string frmname;
			if (formInfo != null && (frmname = formInfo.frmname) != null)
			{
				if (!(frmname == "addfolder"))
				{
					return;
				}
				string string_ = formInfo.para.ToString();
				this.method_1(string_);
			}
		}

		// Token: 0x0600024A RID: 586 RVA: 0x0001CF04 File Offset: 0x0001B104
		private void method_1(string string_0)
		{
			this.treeFileList.Nodes.Clear();
			DirectoryInfo directoryInfo = new DirectoryInfo(string_0);
			TreeNode treeNode = new TreeNode();
			treeNode.Text = directoryInfo.Name;
			this.treeFileList.Nodes.Add(treeNode);
			treeNode.Expand();
			DirectoryInfo[] directories = directoryInfo.GetDirectories();
			for (int i = 0; i < directories.Length; i++)
			{
				DirectoryInfo directoryInfo2 = directories[i];
				if (!directoryInfo2.Attributes.ToString().Contains("Hidden"))
				{
					TreeNode treeNode2 = new TreeNode(directoryInfo2.Name);
					treeNode2.Text = directoryInfo2.Name;
					TreeNode arg_95_0 = treeNode2;
					treeNode2.SelectedImageIndex = 0;
					arg_95_0.ImageIndex = 0;
					treeNode.Nodes.Add(treeNode2);
					this.method_2(treeNode2, directoryInfo2);
				}
			}
			FileInfo[] files = directoryInfo.GetFiles();
			for (int j = 0; j < files.Length; j++)
			{
				FileInfo fileInfo = files[j];
				TreeNode treeNode3 = new TreeNode();
				treeNode3.Text = fileInfo.Name;
				string text = fileInfo.Extension.ToLower().Replace(".", "");
				string key;
				switch (key = text)
				{
				case "htm":
				case "html":
				{
					TreeNode arg_1E2_0 = treeNode3;
					treeNode3.SelectedImageIndex = 2;
					arg_1E2_0.ImageIndex = 2;
					treeNode3.Tag = fileInfo.FullName;
					break;
				}
				case "css":
				{
					TreeNode arg_202_0 = treeNode3;
					treeNode3.SelectedImageIndex = 4;
					arg_202_0.ImageIndex = 4;
					treeNode3.Tag = fileInfo.FullName;
					break;
				}
				case "js":
				{
					TreeNode arg_222_0 = treeNode3;
					treeNode3.SelectedImageIndex = 5;
					arg_222_0.ImageIndex = 5;
					treeNode3.Tag = fileInfo.FullName;
					break;
				}
				case "xml":
				{
					TreeNode arg_242_0 = treeNode3;
					treeNode3.SelectedImageIndex = 6;
					arg_242_0.ImageIndex = 6;
					treeNode3.Tag = fileInfo.FullName;
					break;
				}
				case "png":
				case "gif":
				case "jpg":
				case "jpeg":
				{
					TreeNode arg_262_0 = treeNode3;
					treeNode3.SelectedImageIndex = 3;
					arg_262_0.ImageIndex = 3;
					break;
				}
				}
				treeNode.Nodes.Add(treeNode3);
			}
		}

		// Token: 0x0600024B RID: 587 RVA: 0x0001D198 File Offset: 0x0001B398
		private void method_2(TreeNode treeNode_0, DirectoryInfo directoryInfo_0)
		{
			DirectoryInfo[] directories = directoryInfo_0.GetDirectories();
			for (int i = 0; i < directories.Length; i++)
			{
				DirectoryInfo directoryInfo = directories[i];
				if (!directoryInfo.Attributes.ToString().Contains("Hidden"))
				{
					TreeNode treeNode = new TreeNode(directoryInfo.Name);
					treeNode.Text = directoryInfo.Name;
					TreeNode arg_4C_0 = treeNode;
					treeNode.SelectedImageIndex = 0;
					arg_4C_0.ImageIndex = 0;
					treeNode_0.Nodes.Add(treeNode);
					this.method_2(treeNode, directoryInfo);
				}
			}
			FileInfo[] files = directoryInfo_0.GetFiles();
			for (int j = 0; j < files.Length; j++)
			{
				FileInfo fileInfo = files[j];
				if (!fileInfo.Attributes.ToString().Contains("Hidden"))
				{
					TreeNode treeNode2 = new TreeNode(fileInfo.Name);
					treeNode2.Text = fileInfo.Name;
					string text = fileInfo.Extension.ToLower().Replace(".", "");
					string key;
					switch (key = text)
					{
					case "htm":
					case "html":
					{
						TreeNode arg_1BD_0 = treeNode2;
						treeNode2.SelectedImageIndex = 2;
						arg_1BD_0.ImageIndex = 2;
						treeNode2.Tag = fileInfo.FullName;
						break;
					}
					case "css":
					{
						TreeNode arg_1DD_0 = treeNode2;
						treeNode2.SelectedImageIndex = 4;
						arg_1DD_0.ImageIndex = 4;
						treeNode2.Tag = fileInfo.FullName;
						break;
					}
					case "js":
					{
						TreeNode arg_1FD_0 = treeNode2;
						treeNode2.SelectedImageIndex = 5;
						arg_1FD_0.ImageIndex = 5;
						treeNode2.Tag = fileInfo.FullName;
						break;
					}
					case "xml":
					{
						TreeNode arg_21D_0 = treeNode2;
						treeNode2.SelectedImageIndex = 6;
						arg_21D_0.ImageIndex = 6;
						treeNode2.Tag = fileInfo.FullName;
						break;
					}
					case "png":
					case "gif":
					case "jpg":
					case "jpeg":
					{
						TreeNode arg_23D_0 = treeNode2;
						treeNode2.SelectedImageIndex = 3;
						arg_23D_0.ImageIndex = 3;
						break;
					}
					}
					treeNode_0.Nodes.Add(treeNode2);
				}
			}
		}

		// Token: 0x06000254 RID: 596 RVA: 0x0001D4F8 File Offset: 0x0001B6F8
		private void treeFileList_BeforeCollapse(object sender, TreeViewCancelEventArgs e)
		{
			e.Node.ImageIndex = 0;
		}

		// Token: 0x06000253 RID: 595 RVA: 0x0001D4E8 File Offset: 0x0001B6E8
		private void treeFileList_BeforeExpand(object sender, TreeViewCancelEventArgs e)
		{
			e.Node.ImageIndex = 1;
		}

		// Token: 0x06000256 RID: 598 RVA: 0x0001D52C File Offset: 0x0001B72C
		private void treeFileList_DragDrop(object sender, DragEventArgs e)
		{
			string[] array = e.Data.GetData(DataFormats.FileDrop, false) as string[];
			string string_ = array[0];
			this.method_1(string_);
		}

		// Token: 0x06000255 RID: 597 RVA: 0x0001D508 File Offset: 0x0001B708
		private void treeFileList_DragEnter(object sender, DragEventArgs e)
		{
			if (e.Data.GetDataPresent(DataFormats.FileDrop))
			{
				e.Effect = DragDropEffects.Copy;
				return;
			}
			e.Effect = DragDropEffects.None;
		}

		// Token: 0x0600024C RID: 588 RVA: 0x0001D408 File Offset: 0x0001B608
		private void treeFileList_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
		{
			TreeNode node = e.Node;
			if (node != null && node.Tag != null)
			{
				MiddleModule.SendMessage(this, new FormInfo
				{
					frmname = "loadfile",
					para = node.Tag.ToString()
				});
			}
		}

		// Token: 0x06000252 RID: 594 RVA: 0x0001D4E4 File Offset: 0x0001B6E4
		private void 删除文件ToolStripMenuItem_Click(object sender, EventArgs e)
		{
		}

		// Token: 0x0600024F RID: 591 RVA: 0x0001D4D8 File Offset: 0x0001B6D8
		private void 剪切CutToolStripMenuItem_Click(object sender, EventArgs e)
		{
		}

		// Token: 0x06000250 RID: 592 RVA: 0x0001D4DC File Offset: 0x0001B6DC
		private void 复制CopyToolStripMenuItem_Click(object sender, EventArgs e)
		{
		}

		// Token: 0x0600024E RID: 590 RVA: 0x0001D488 File Offset: 0x0001B688
		private void 打开文件ToolStripMenuItem_Click(object sender, EventArgs e)
		{
			TreeNode selectedNode = this.treeFileList.SelectedNode;
			if (selectedNode != null && selectedNode.Tag != null)
			{
				MiddleModule.SendMessage(this, new FormInfo
				{
					frmname = "loadfile",
					para = selectedNode.Tag.ToString()
				});
			}
		}

		// Token: 0x0600024D RID: 589 RVA: 0x0001D450 File Offset: 0x0001B650
		private void 打开文件位置ToolStripMenuItem_Click(object sender, EventArgs e)
		{
			TreeNode selectedNode = this.treeFileList.SelectedNode;
			if (selectedNode != null)
			{
				Process.Start("Explorer", "/select," + selectedNode.Tag);
			}
		}

		// Token: 0x06000251 RID: 593 RVA: 0x0001D4E0 File Offset: 0x0001B6E0
		private void 重命名RenameToolStripMenuItem_Click(object sender, EventArgs e)
		{
		}

		// Token: 0x04000271 RID: 625
		private ContextMenuStrip cmenu_fileop;

		// Token: 0x0400026F RID: 623
		private IContainer icontainer_0;

		// Token: 0x04000278 RID: 632
		private ImageList imageList_0;

		// Token: 0x04000270 RID: 624
		private TreeView treeFileList;

		// Token: 0x04000272 RID: 626
		private ToolStripMenuItem 删除文件ToolStripMenuItem;

		// Token: 0x04000275 RID: 629
		private ToolStripMenuItem 剪切CutToolStripMenuItem;

		// Token: 0x04000276 RID: 630
		private ToolStripMenuItem 复制CopyToolStripMenuItem;

		// Token: 0x04000274 RID: 628
		private ToolStripMenuItem 打开文件ToolStripMenuItem;

		// Token: 0x04000273 RID: 627
		private ToolStripMenuItem 打开文件位置ToolStripMenuItem;

		// Token: 0x04000277 RID: 631
		private ToolStripMenuItem 重命名RenameToolStripMenuItem;
	}
}
